import jwt from 'jsonwebtoken';
import config from '../config';

/**
 * 生成JWT令牌
 */
export const generateToken = (payload: any): string => {
  return jwt.sign(payload, config.jwt.secret, {
    expiresIn: config.jwt.expiresIn
  });
};

/**
 * 验证JWT令牌
 */
export const verifyToken = (token: string): any => {
  return jwt.verify(token, config.jwt.secret);
};